package com.source.adnroid.comm.ui.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.aspsine.swipetoloadlayout.SwipeToLoadLayout;
import com.source.adnroid.comm.ui.adapter.ChatMessageAdapter;
import com.source.adnroid.comm.ui.adapter.OnItemClickListener;
import com.source.adnroid.comm.ui.adapter.UserListAdapter;
import com.source.adnroid.comm.ui.fragment.ChatBaseFragment;
import com.source.android.androidcomm.R;

import java.util.ArrayList;

public class UserListActivity extends AppCompatActivity implements OnItemClickListener {
    private String TAG = "ChatBaseFragment";
    SwipeToLoadLayout swipeToLoadLayout;//刷新 加载 控件
    RecyclerView recyclerView;//聊天信息控件
    LinearLayoutManager linearLayoutManager;
    UserListAdapter userListAdapter;
    ArrayList list = new ArrayList<String>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_list);
        initView();
    }

    private void initView() {
        list = new ArrayList();
        list.add("1");
        list.add("1");
        list.add("1");
        swipeToLoadLayout = findViewById(R.id.swipeToLoadLayout);
        recyclerView = findViewById(R.id.swipe_target);
        //为recyclerView设置布局管理器
        linearLayoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(linearLayoutManager);
        userListAdapter = new UserListAdapter(list);
        //为recyclerView设置适配器
        recyclerView.setAdapter(userListAdapter);
        userListAdapter.setOnItemClickListener(this);
    }

    @Override
    public void onClick(int position) {
        Intent intent=new Intent();
        intent.setClass(this,ChatActivity.class);
        startActivity(intent);
    }

    @Override
    public void onLongClick(int position) {

    }
}
